﻿@model IEnumerable<JaxaraRnD.Models.Objects.Product>
@using JaxaraRnD.Helpers
@{
    ViewBag.Title = "Index";
}

<h2>Product List</h2>

@if (Model != null && Model.Count() > 0)
{
    var grid = new WebGrid(source: Model, rowsPerPage: JaxaraRnDUtility.GridConstants.ROWS_PER_PAGE);
    <div id="grid">
        @grid.GetHtml(
                tableStyle: "gridTable",
                headerStyle: "gridTableHeader",
                rowStyle: "rowstyle",
                alternatingRowStyle: "alternaterowstyle",
                   footerStyle: "paging",
                columns:
                grid.Columns(
                grid.Column("Name", "Product Name"),
                grid.Column("Category", "Category "),
                grid.Column("Edit", "Edit", format: @<a href="Product/Edit/@item.Id">
                    <img src="../Images/ico-edit.png" alt="Edit" /></a>, canSort: false, style: "text-align-center"),
                grid.Column("Details", "Details", format: @<a href="Product/Details/@item.Id">
                    <img src="../Images/ico-view-detailed.png" alt="Details" /></a>, canSort: false, style: "text-align-center"),
                grid.Column("Delete", "Delete", format: @<a href="Product/Delete/@item.Id">
                    <img src="../Images/ico-delete.png" alt="Delete" /></a>, canSort: false, style: "text-align-center")
            )
            )
    </div>
}
else
{
    <text><div class="no-data-found">@JaxaraRnDUtility.GridConstants.EMPTY_DATA_MESSAGE</div></text>
}
<p>
    @Html.ActionLink("Add New", "Create")
</p>
